package com.example.clockkotlin.databaseClockAlarm

/**
 * This class used for creating clock alarms that stores: alarm [time], [isFatal] can enable or disable, and it position in data base as [id]
 *
 * @param time alarm time must have a look like this 00:05, 14:39 etc.
 * @param isFatal enable that represents for enable or disable clock signal
 * @param id position in [LocalDataBase]
 */
class ExistedError(val id: Long, val time: String, val errorCode:String, var isFatal: Boolean) {

    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as ExistedError

        if (time != other.time) return false
        if (errorCode != other.errorCode) return false
        if (isFatal != other.isFatal) return false
        if (id != other.id) return false

        return true
    }

    override fun hashCode(): Int {
        var result = time.hashCode()
        result = 31 * result + isFatal.hashCode()
        result = 31 * result + errorCode.hashCode()
        result = 31 * result + id.hashCode()
        return result
    }

    override fun toString(): String {
        return "ExistedError(time=$time, isFatal=$isFatal,errorCode=$errorCode, id=$id)"
    }
}
